
git clone  https://git.oschina.net/wr4ng1er/rsync-3.1.1.git

cd rsync-3.1.1/

./configure --prefix=/opt/rsyncd && make && make install

echo 'export PATH=$PATH:/opt/rsyncd/bin' >> /etc/profile 
source /etc/profile 



mkdir /opt/rsyncd/etc/ -p
mkdir /opt/rsyncd/run/ -p
touch /opt/rsyncd/etc/rsyncd.conf  
touch /opt/rsyncd/etc/rsyncd.secrets  
touch /opt/rsyncd/etc/rsyncd.motd
chmod 600 /opt/rsyncd/etc/rsyncd.secrets  

rm -rf /etc/rsyncd.*
ln -s /opt/rsyncd/etc/rsyncd.conf /etc/rsyncd.conf 
ln -s /opt/rsyncd/etc/rsyncd.secrets  /etc/rsyncd.secrets 
ln -s /opt/rsyncd/etc/rsyncd.motd  /etc/rsyncd.motd


#wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz



pkill rsync
rsync --daemon  --config=/opt/rsyncd/etc/rsyncd.conf
cat /opt/rsyncd/run/rsyncd.pid
netstat -tupln  | grep rsync
lsof -i:8730




chmod 755 /etc/init.d/rsyncd
sudo /etc/init.d/rsyncd  restart




chkconfig rsyncd on
chkconfig --add rsyncd
chmod +x /etc/init.d/rsyncd

yum install xinetd -y


sodu /etc/init.d/xinetd restart
service xinetd restart

netstat -tupln  | grep rsync
lsof -i:873
pkill rsync

182.254.131.64

/etc/sysconfig/iptables
-A INPUT -p tcp -s 182.254.131.64 --dport 8730 -j ACCEPT
-A INPUT -s 182.254.131.0/24 -p tcp -m tcp --dport 8730 -j ACCEPT
-A INPUT -s 182.254.131.0/24 -p tcp -m tcp --dport 8730 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8730 -j DROP

service iptables restart

iptables -L

rsync   --port 8730 --list-only  pmta@103.234.245.2::

rsync -avzP www@192.168.1.100::www   www
rsync -avzP www@192.168.1.100::www   www
rsync -av  -e ssh root@192.168.10.100:/www  www


rsync --port 8730  -vzrtopg --progress 103.234.245.2:/var/log/pmta      /www/pmta/103.234.245.2

cat > 103.234.245.2.sh<<EEEOOOFFF
#!/bin/sh
#103.234.245.2 pmta backup
rsync --port 8730  -vzrtopg --progress 103.234.245.2:/var/log/pmta      /www/pmta/103.234.245.2
EEEOOOFFF

chmod 755 /opt/rsyncd/cron/*.sh 

# Run daily cron jobs at 4:10 every day  backup pmta data: 
* * */1 * * /usr/bin/run-parts   /opt/rsyncd/cron    1> /dev/null

